<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/project/ui-res-v3.css">
<link rel="stylesheet" href="css/project/ui-input-v3.css">
<link rel="stylesheet" href="css/project/ui-color-v3.css">
<link rel="stylesheet" href="css/project/style.css">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-img.css?v=202022">
<link rel="stylesheet" href="css/ui-box.css?v=202022">
<link rel="stylesheet" href="css/ui-color.css?v=202022">
<link rel="stylesheet" href="css/lbbbase.css">
<link rel="stylesheet" href="css/zv_common.css">

<style>
    .center{
        margin: 0 auto;
    }
    .w60{width:5.0em;}
    .E5E3E0{background-color:#E5E3E0;}
    .border{
        border: 1px solid #D0CCC7;
    }
    .mb3{margin-bottom:.5em;}
    input[type="radio"]:checked + div.rad-ch{
        display: none !important;
    }
    input[type="radio"]:checked + div.rad-ch{
        display: none !important;
    }
    input[type="radio"] + div.rad-ch{
    }
    .utra{
        -webkit-transition:all 300ms ease-out 1ms
    }
    input[type="radio"]:checked + div.res-down{
        -webkit-transform:rotate(180deg);
    }
    .scale0{
        /*-webkit-transform:scale(0.5,0.5);
        -webkit-transform:translateX(-50%);*/
        opacity:0.3;
    }
    .res-down{
        background-image:url('images/down-angle.png');
    }
    
    .res-wh{
        width: 3em;
        height: .6em;
    }
    
    .uinn_3 {
            padding: 0.3em;
            /*margin: 0;*/
        }
    .c-field{
        background-color:#7E808B;
    }
    .top10{
        top:1em;
    }
    .c25{
        color:#72706B;
    }
    input[type="radio"]:checked + div > div.rdi-icon {
        background-color: transparent;
        background-image: url(images/icon_checked.png);
    }
    input[type=radio]+div>div.rdi-icon {
        background-color: transparent;
        background-image: url(images/icon_uncheck.png);
    }
    
    input[type="radio"]:checked + div.rdi {
        box-shadow:inset 0 1px 4px rgba(0,0,0,0.6);
    }
    .res{
        background-image:url('images/b-arr.png');
    }
    .uhide {
        display: none !important;
    }
</style>
</head>
<body class="um-vp c-wh" ontouchstart>
<div id="page_0" class="up ub ub-ver" tabindex="0">
   
    <!-- 内容 -->
    <div id="content" class="center content top10 wtp98 ">
       <!-- 申请内容 -->
        <div class="ub ub-ac c-field uc-r1 uc-l1 mb6" ontouchstart="zy_touch()" onclick="changeField(0);" id="mu-0" name="dominField">
            <div class="ub-f1 uinn_3 u-fw lh15 ml4 t-wh" id="dn0">申请内容</div>
            <input class="uhide" type="radio" name="iocnr0" id="ic-0">
            <div class="ub-img5 res-wh res-down utra"></div>
        </div>
        <input class="uhide" type="radio" name="f0" id="fd-0" checked="true">
        <div class="rad-ch utra" id="add-0">
            <div class="uinn5 fs9">
                <div class="ub uc-a1 lh10 center c2 border mb3" onclick="">
                    <div class="w62 uinn_3 c25 tx-r mr5">申请人</div>
                    <div class="tx-l uinn_3 tx-l" id="cnName"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">部&nbsp;&nbsp;&nbsp;&nbsp;门</div>
                    <div class="tx-l uinn_3 tx-l" id="deptName"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">用工类别</div>
                    <div class="tx-l uinn_3 tx-l" id="empType"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">参加工作时间</div>
                    <div class="tx-l uinn_3 tx-l" id="startWorkDate"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">进入公司时间</div>
                    <div class="tx-l uinn_3 tx-l" id="enterCompanyDate"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">申请类别</div>
                    <div class="tx-l uinn_3 tx-l" id="applyType"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">申请理由</div>
                    <div class="tx-l uinn_3 tx-l" id="applyReason">申请理由申请理由</div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">开始时间</div>
                    <div class="tx-l uinn_3 tx-l" id="startDate"></div>
                </div>
                <div class="ub uc-a1 lh10 center c2 border mb3" >
                    <div class="w62 uinn_3 c25 tx-r mr5">结束时间</div>
                    <div class="tx-l uinn_3 tx-l" id="endDate"></div>
                </div>
                <!-----总工时 总天数----->
                <div class="ub center mb3 lh10">
                    <div class="ub wtp50 uc-a1 c2 border" >
                        <div class="w50 c25 tx-r mr5 uinn_3 ">总工时</div>
                       <div class="tx-l uinn_3" id="totalTime"></div>
                    </div>
                    <div class="ub wtp50 ub-f1 uc-a1 c2 border ml2" >
                        <div class="c25 tx-r mr5 uinn_3 ">总天数</div>
                        <div class="tx-l uinn_3" id="totalDay"></div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 分管领导审批 -->
        <div class="ub ub-ac c-field uc-r1 uc-l1 mb6" ontouchstart="zy_touch()" onclick="changeField(1);" id="mu-0" name="dominField">
            <div class="ub-f1 uinn_3 u-fw lh15 ml4 t-wh" id="dn1">分管领导审批</div>
            <input class="uhide" type="radio" name="iocnr1" id="ic-1">
            <div class="ub-img5 res-wh res-down utra"></div>
        </div>
        <input class="uhide" type="radio" name="f1" id="fd-1" checked="true">
        <div class="rad-ch utra" id="add-1">
            <div class="uinn5 fs9">
                <div class="ub center mb3 lh10 uhide" id="subGroup">
                    <div class="ub wtp35" >
                       <div class="c25 ">领导：</div>
                       <div class="" id="subLeader">李建波</div>
                    </div>
                    <div class="ub wtp65 ub-f1" >
                         <div class="c25">时间：</div>
                       <div class="" id="subTime">2016-07-01&nbsp;&nbsp;08:30:21</div>
                    </div>
                </div>
                <div class="uba uc-a1 c76 uinput">    
                    <textarea id="subRemark" placeholder="意见:同意否？"  name="textarea-0"  class="uc-a1" style="height:8em;resize:none;"></textarea>
                </div>
                <div class="ub-f1 ub uba  b-wh  sel noboder center" id="radio_sub">
                    <!--单选按钮开始-->
                    <input type="radio" name="che1" class="uhide"  value="Y"  id="sub_pass" checked="checked">
                    <div onclick="zy_for(event);radioClick('sub_pass');" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
                        <div class="rdi-icon ub-img w15"></div>
                    </div>
                   
                    <!--单选按钮结束-->
                    <div class="ub-f1 ut-s uinn tx-l ulh-sel">待部领导审批</div>
                    <!--单选按钮开始-->
                    <input type="radio" name="che1" class="uhide"  value="W"  id="sub_nopass" >
                    <div onclick="zy_for(event);radioClick('sub_nopass');" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
                        <div class="rdi-icon ub-img w15"></div>
                    </div>
                    <!--单选按钮结束-->
                    <div class="ub-f1 ut-s uinn tx-l ulh-sel">审批不通过</div>
                </div>
                <!--下拉列表-->
                 <div class="" id="subList">
                       <!---处理人1---->
                        <div class="ub uc-a1 tx-c wtp98 lh10 center c2 border mb3 " id="dealType_one">
                            <div class="ub-f1 ub uba  b-wh  sel noboder">
                                <div class="tx-l uinn5 ub-f1 ut-s" id="nextDealers"></div>
                                <div class="b-gra  umw2 ub ub-pc ub-ac">
                                    <div class="ub-img umw1 umh1 res"></div>
                                </div>
                                <select name="Carrier" selectedindex="0" id="sel_nextDealers" onchange="zy_selectmenu(this.id)">
                                        
                                 </select>
                            </div>
                        </div>
                        
                        <!---处理人2---->
                        <div class="ub uc-a1 wtp98 lh10 center c2 border mb3" id="dealType_multi">
                            <div class="ub-f1  uba b-wh sel noboder ml20 mt6" id="chkOptions">
                                <!---div class="i-check " >  
                                   <input type="checkbox" value="0" />  
                                   <label class="ub-f1 ut-s uinn tx-l ulh-sel">李建波</label>  
                                </div>  
                                <div class="i-check">  
                                   <input type="checkbox" value="0" />  
                                   <label class="ub-f1 ut-s uinn tx-l ulh-sel">王莹</label>  
                                </div!--->
                            </div>
                        </div>
                        
                 </div>
                 <!--下拉列表结束-->
            </div>
        </div>
        <!-- 部领导审批 -->
        <div class="ub ub-ac c-field uc-r1 uc-l1 uhide" ontouchstart="zy_touch()" onclick="changeField(2);" id="deptLeaderGroup" name="dominField">
            <div class="ub-f1 uinn_3 u-fw lh15 ml4 t-wh" id="dn2">部领导审批</div>
            <input class="uhide" type="radio" name="iocnr2" id="ic-2">
            <div class="ub-img5 res-wh res-down utra"></div>
        </div>
        <input class="uhide" type="radio" name="f2" id="fd-2" checked="true">
        <div class="rad-ch utra uinn5" id="add-2">
            <div class="fs9">
                <div class="uba uc-a1 c76 uinput">    
                    <textarea id="deptRemark" placeholder="意见:同意否？"  name="textarea-0"  class="uc-a1" style="height:8em;resize:none;"></textarea>
                </div>
            </div>
            
            <div class="ub-f1 ub uba  b-wh  sel noboder center">
                <!--单选按钮开始-->
                <input type="radio" name="cher1" class="uhide"  value="Y"  id="dept_pass" checked="checked">
                <div onclick="zy_for(event);DeptRadioClick('dept_pass');" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
                    <div class="rdi-icon ub-img w15"></div>
                </div>
               
                <!--单选按钮结束-->
                <div class="ub-f1 ut-s uinn tx-l ulh-sel">审批通过</div>
                <!--单选按钮开始-->
                <input type="radio" name="cher1" class="uhide"  value="W"  id="dept_nopass" >
                <div onclick="zy_for(event);DeptRadioClick('dept_nopass');" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
                    <div class="rdi-icon ub-img w15"></div>
                </div>
                <!--单选按钮结束-->
                <div class="ub-f1 ut-s uinn tx-l ulh-sel">审批不通过</div>
            </div>
            
        </div>
        
        
    
</div>
<script src="js/appcan.js"></script>
<script src="js/zy_control.js?v=202022"></script>
<script src="js/zy_click.js?v=202022"></script>
<script src="js/jquery-1.11.1.min.js?v=202022"></script>
<script src="js/main.js"></script>
<script src="js/apply.js?v=202022"></script>
<script>
zy_init();
window.uexOnload = function(type){
    if (!type) {
         exitreturn();
         //申请人基本信息获取
         getApplyInfoByTaskIdFuc(function(json){applyInfoByTaskId(json);});
         //获取审批历史记录及下一步处理步骤等信息
         getCheckInfoByTaskIdFuc(function(json){checkInfoByTaskId(json);});
    };
}; 
function changeField(i){
    // logs('[tabList] changeField() --------->'+i);
    var ele1 = $$('fd-'+i);
    ele1.checked = !ele1.checked;
    var ele2 = $$('ic-'+i);
    ele2.checked = !ele2.checked;
}
var currentNode='';
function applyInfoByTaskId(json){
    if(json.status==0)
    {
        if(json.data.msg=="当前任务已被处理")
        {
            $("#content").text("当前任务已被处理!");
            return;
        }
        var leaveApply=json.data.leaveApply;
        $("#cnName").text(leaveApply.cnName);
        $("#deptName").text(leaveApply.deptName);
        $("#empType").text(leaveApply.empType);
        
        if(leaveApply.startWorkDate!=null){
            var startWorkDate = new Date(leaveApply.startWorkDate.time);
            $("#startWorkDate").text(getTimeStr(startWorkDate));
        }
        
        if(leaveApply.enterCompanyDate!=null){
            var enterCompanyDate = new Date(leaveApply.enterCompanyDate.time);
            $("#enterCompanyDate").text(getTimeStr(enterCompanyDate));
        }
        
        $("#applyType").text(applyType(leaveApply.applyType));
        $("#applyReason").text(leaveApply.applyReason);
        
        var startime = new Date(leaveApply.startDate.time);
        
        $("#startDate").text(getTimeStr(startime)+" "+leaveApply.startTime);
        
        var endtime = new Date(leaveApply.endDate.time);
        $("#endDate").text(getTimeStr(endtime)+" "+leaveApply.endTime);
        
        $("#cnName").text(leaveApply.cnName);
        $("#totalTime").text(leaveApply.totalTime);
        $("#totalDay").text(leaveApply.totalDay);
        
        
        //判断审批节点到哪一步：分管领导审批 or待部领导审批
        currentNode=leaveApply.status;
        if( currentNode=="待部领导审批")
        {
            $("#deptLeaderGroup").removeClass("uhide");
            $("#subRemark").attr("readonly","readonly");
            // nextTask="";
        }else{
            // $("#deptLeaderGroup").addClass("uhide");
        }
        
        //相关字段记录
        userName=leaveApply.userName;
        applyId=leaveApply.applyId;
        
    }
}
var dealType='';
var nextStepsObj;
function checkInfoByTaskId (json) {
   if(json.status==0)
     {
         nextStepsObj=json.data.nextSteps;
         nextStep=nextStepsObj[0].stepValue;
         nextTask=nextStepsObj[0].stepName;
         if(json.data.node!=null)
         {
             // console.log(nextStepsObj[0])
             dealType=json.data.node.dealType;
             // alert(dealType)
             dealType="one";  //test
             if(dealType=="one")
             {
                 $("#dealType_one").removeClass("uhide");
                 $("#dealType_multi").addClass("uhide");
                 //处理人
                 var nodeUsersArr=json.data.nodeUsers;
                 var len=nodeUsersArr.length;
                 console.log("nodeUsersArr: "+nodeUsersArr)
                 for(var i=0;i<len;i++)
                 {
                     $("#sel_nextDealers").append("<option value='"+nodeUsersArr[i].userName+"'>"+nodeUsersArr[i].fullUserName+"</option>"); 
                     
                 }
                 var nextDealers=$("#sel_nextDealers").find("option:selected").text();
                 $("#nextDealers").text(nextDealers);
             }else if(dealType=="multi")
             {
                 $("#dealType_multi").removeClass("uhide");
                 $("#dealType_one").addClass("uhide");
                 //处理人
                 var nodeUsersArr=json.data.nodeUsers;
                 var len=nodeUsersArr.length;
                 for(var i=0;i<len;i++)
                 {
                     $("#chkOptions").append("<div class='i-check' ><input type='checkbox' name='category' value='"+nodeUsersArr[i].userName+"' /><label class='ub-f1 ut-s uinn tx-l ulh-sel'>"+nodeUsersArr[i].fullUserName.split("\\")[1]+"</label></div>");
                 }
                 // var nextDealers=$("#sel_nextDealers").find("option:selected").text();
                 // $("#nextDealers").text(nextDealers);
             }else if(dealType=="all")
             {
                 
             }
         }
         //分管领导审批过
         if(json.data.operateLogs!=null&&json.data.operateLogs.length==2)
         {
             $("#radio_sub").addClass("uhide");
             $("#subList").addClass("uhide");
             $("#subGroup").removeClass("uhide");
             var logObj=json.data.operateLogs[1];
             
             var creatorName=logObj.creatorName;  //审批领导名
             remark=logObj.remark;    //审批意见
             var createTime=new Date(logObj.createTime.time);  //审批时间
             $("#subLeader").text(creatorName);
             $("#subTime").text(getTimeStrDetail(createTime));
             $("#subRemark").val(remark);
             
         }
         
         
     }  
}
/*
 * 分管领导审批单选按钮
 */
function radioClick(id){
    if(id=="sub_pass")
    {
        if($("#subList").hasClass("uhide")) 
        {
            $("#subList").removeClass("uhide");
        }
        nextStep=nextStepsObj[0].stepValue;
        nextTask=nextStepsObj[0].stepName;
    }else{
        $("#subList").addClass("uhide");
        nextDealers="";
        nextCnDealers="";
        nextStep=nextStepsObj[1].stepValue;
        nextTask=nextStepsObj[1].stepName;
    }
}

/*
 * 部领导审批单选按钮
 */
function DeptRadioClick(id){
    if(id=="dept_pass")
    {
        nextStep=nextStepsObj[0].stepValue;
        nextTask=nextStepsObj[0].stepName;
    }else{
        nextDealers="";
        nextCnDealers="";
        nextStep=nextStepsObj[1].stepValue;
        nextTask=nextStepsObj[1].stepName;
    }
}
var userName='';
var applyId='';
var nextStep='';
var nextTask='';
var remark='';
var nextDealers="";
var nextCnDealers="";
var doProcessStr='';
function submitData(){
    // alert("submit")
   var taskId=localStorage.getItem("applyTaskid");
  
    if(currentNode=="分管领导审批")
    {
        checkedOptions();  
        remark=$("#subRemark").val();
    }else{
        remark=$("#deptRemark").val();
    }
  doProcessStr="userName="+userName+"&nextStep="+nextStep+"&nextTask="+nextTask+"&remark="+remark+"&taskId="+taskId+"&applyId="+applyId+"&nextDealers="+nextDealers+"&nextCnDealers="+nextCnDealers;
  // console.log(doProcessStr)
  if(remark=='')
  {
       appcan.window.alert({
            title:'提示',
            content:'审批意见不能为空！',
            buttons:'确定'
         });
         return;
  }
  getDoProcessFuc(doProcessStr);
}

/**
  * 检查哪些项被选中
  */
function checkedOptions(){
    nextDealerstr='';
    if(dealType=="one")
    {
        nextDealers=$("#sel_nextDealers").find("option:selected").val();
        nextCnDealers=$("#sel_nextDealers").find("option:selected").text().split("\\")[1];
    }
    else{
        var items = document.getElementsByName("category");
        if(items.length==0)
        {
            return;
        }
        for (var i = 0; i < items.length; ++i)
        {
            if (items[i].checked)
            {
                nextDealers+=items[i].value+",";
                nextCnDealers+=$(items[i]).next().text()+",";
            }
        }
        nextDealers=nextDealers.substr(0,nextDealers.length-1);
        nextCnDealers=nextCnDealers.substr(0,nextCnDealers.length-1);
    }
    
}
</script>
</body>
</html>